You are here: Statements and Functions > Do...Until
Syntax samples
DO <statement block> UNTIL <Boolean expression>
DO INC Var1 UNTIL Array1[Var1] <> 10
DO
BEGIN
INC Var2, 5
WAIT 5 sec
END
UNTIL FreeCap(Loc1) > 5
Repeats a statement or statement block continuously while a condition remains false. DO...UNTIL is an exit-condition loop, meaning that the loop will always be executed at least once. Use DO...UNTIL when an operation will always be executed at least one time and possibly more times.
Any logic.
Components
<statement block>
The statement or block of statements to execute.
<Boolean expression>
As long as this expression is FALSE, the loop will continue. This expression is evaluated for each iteration of the loop.
Example
A machining station can manufacture parts of increasing complexity from the same entity, called a Blank. When a Blank arrives at the station, the value stored in Attr1 determines the complexity of the part and the amount of time needed to create the new part. The following logic models this situation with a DO...UNTIL loop. All blanks that arrive go through a five minute processing time, and then go through the operation several more times depending on the value of Attr1.
Process Table
Entity |
Location |
Operation (min) |
---|---|---|
Blank |
Machining |
INT Count = 0 DO BEGIN WAIT 5 min INC Count END UNTIL Count = Attr1 |
Routing Table
Blk |
Output |
Destination |
Rule |
Move Logic |
---|---|---|---|---|
1 |
Base |
Painting |
FIRST 1 |
|
BEGIN, END, DO...WHILE, and WHILE...DO.